def timeit(func):
    import time
    def wrapper(*a, **k):
        t0 = time.time()
        r = func(*a, **k)
        print(func.__name__, "took", time.time()-t0)
        return r
    return wrapper

@timeit
def work(n):
    return sum(i*i for i in range(n))

class A: pass

class RegistryMeta(type):
    registry = {}
    def __new__(mcls, name, bases, ns):
        cls = super().__new__(mcls, name, bases, ns)
        if name != "Base":
            mcls.registry[name] = cls
        return cls

class Base(metaclass=RegistryMeta): pass
class Child(Base): pass

if __name__ == "__main__":
    print(work(100000))
    a = A()
    setattr(a, "x", 123)
    print(getattr(a, "x"))
    print("registry:", RegistryMeta.registry)
